<?php include('./templete/public/head.php')?>
<body>
<hr class="bgcolor" />
<!--评估-->
<div class="assess-main">
    <div class="assess-content ">
        <form class="myform">
            <div class="c-top">
                <ul class="comm-table-view">
                    <li class="table-view-cell table-view-cell2">
                        <a>
                            <span>提议名称</span>
                            <div class="top-text text1">
                                <?php echo $jdz_info['title']?>
                            </div>
                        </a>
                    </li>
                    <li class="table-view-cell table-view-cell2">
                        <a>
                            <span>发放金额</span>
                            <input placeholder="请输入发放金额" id="money" value="<?php echo $info['money']?>" <?php if($info['status']==1){?>readonly<?php }?>>

                        </a>
                    </li>
                </ul>
            </div>
        </form>
        <div class="comm-btn assess-btn">
            <?php if($info['status']!=1){?>
            <span class="color1 adopt">发放</span>
            <?php }?>
            <?php if($info['status']==0){?>
            <span class="color2 unadopt">暂不发放</span>
            <?php }?>
        </div>
    </div>
</div>
<script src="_js/plug/mui.picker.all.js"></script>
<?php include('./templete/public/script.php')?>
</body>
<script>
    $('.adopt').click(function () {
        var money = $("#money").val();
        console.log(money);
        if(!money){
            money=0;
        }
        if(isNaN(money)){
            layer.msg('请输入数字');
            return false
        }
        if((money<0)){
            layer.msg('请输入0-1000的数字');
        }
        if((money>1000)){
            layer.msg('请输入0-1000的数字');
        }
        $.ajax({
            url:"<?php echo url('reward')?>",
            data:{
                jdz_id:<?php echo $info['jdz_id']?>,
                money:money,
                status:1
            },
            success:function (data) {
                if(data.code==1){
                    location.href="<?php echo url('index')?>"
                }else{
                    layer.msg(data.msg);
                }
            }
        })
    })


    $('.unadopt').click(function () {

        $.ajax({
            url:"<?php echo url('reward')?>",
            data:{
                jdz_id:<?php echo $info['jdz_id']?>,
                status:2
            },
            success:function (data) {
                if(data.code==1){
                    location.href="<?php echo url('index')?>"
                }else{
                    layer.msg(data.msg);
                }
            }
        })
    })
</script>

</html>